<?php

class ArticleController extends HomeController
{
public function actionIndex()
	{
		$s_categoryUrl = $_REQUEST["categoryUrl"];
		$i_articleId	= $_REQUEST["articleId"];
		$s_articleUrl	= $_REQUEST["articleUrl"];
		
		$dataProvider=new CActiveDataProvider(
			"Article",
			array(
				"criteria"=>array(
					//"condition"=>"article_category=1",
					//'order'=>'create_time DESC',
					'with'=>array(
						'ArticleCategory'=>array(
								'condition'=>'`ArticleCategory`.`url_mapping`= "'.$s_categoryUrl.'"'
						),
					),//End With
					'together'=>true
				),//End array criticle
				"pagination"=>array(
					"pageSize"=>10
				)//End array pagination
			)//End array pagination
		);
		
		$m_model = $this->loadModel($i_articleId);		
		$this->render("index",array("o_model"=>$m_model,"arr_data"=>$dataProvider->data));
	}
	
	public function loadModel($i_id)
	{
		$model=Article::model()->findByAttributes(array('identification'=>$i_id));
		if($model===null)
			throw new CHttpException(404,'The requested page does not exist.');
		return $model;
	}
}